﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VM.Common.DataUntil
{
    public class RandomNo
    {
        /// <summary>
        /// 获取6位的随机数
        /// </summary>
        /// <returns></returns>
        public static int GetRandomNo6() {
            Random random = new Random();
            int num = random.Next(100000, 999999);
            return  num;
            
        }

        /// <summary>
        /// 获取8位随机值，从26个英文字母和0-9数字中随机获取
        /// </summary>
        /// <returns></returns>
        public static string GetRandomNo8() 
        {
             
            char[] charSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".ToCharArray();
            Random random = new Random();
            string randomString = "";
            for (int i = 0; i < 8; i++)
            {
                // 从 charSet 中随机取一个字符拼接到结果字符串中
                randomString += charSet[random.Next(charSet.Length)];
            }
            return randomString;

        }
    }
}
